package com.example.its2021606134chh.BusDiyModule;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.its2021606134chh.MainActivity;
import com.example.its2021606134chh.R;

public class BusMapShowActivity extends AppCompatActivity {

    private ImageView imgBusMapBack;
    private ImageView imgBusMap;
    private TextView tvBusMapStartEndPlace;
    private TextView tvBusMapPrice;
    private Button btnBusMapNext;

    @SuppressLint("SetTextI18n")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bus_map_show);
        initView();
        Intent intent1 = getIntent();
        String id = intent1.getStringExtra("id");
        String start_place = intent1.getStringExtra("start_place");
        String end_place = intent1.getStringExtra("end_place");
        String price = intent1.getStringExtra("price");
        tvBusMapStartEndPlace.setText(start_place + "—" + end_place);
        tvBusMapPrice.setText("票价：￥" + price + ".0");
        imgBusMapBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(BusMapShowActivity.this, MainActivity.class));
                finish();
            }
        });
        btnBusMapNext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BusMapShowActivity.this, BusDiyDateActivity.class);
                intent.putExtra("id", id);
                intent.putExtra("start_place", start_place);
                intent.putExtra("end_place", end_place);
                intent.putExtra("price", price);
                startActivity(intent);
                finish();
            }
        });
    }

    private void initView() {
        imgBusMapBack = (ImageView) findViewById(R.id.imgBusMapBack);
        imgBusMap = (ImageView) findViewById(R.id.imgBusMap);
        tvBusMapStartEndPlace = (TextView) findViewById(R.id.tvBusMapStartEndPlace);
        tvBusMapPrice = (TextView) findViewById(R.id.tvBusMapPrice);
        btnBusMapNext = (Button) findViewById(R.id.btnBusMapNext);
    }
}